dmdPMApp.directive("dmddatepicker", function() {
    return {
        restrict: "A",
        require : "ngModel",
        link : function (scope, element, attrs, ngModelCntrl) {
            $(function(){
                element.datepicker({
                    dateFormat:"dd-M-yy",
                    changeMonth:true,
                    changeYear:true,
                    showOtherMonths: true,
                    selectOtherMonths: true,
                    showAnim:"slideDown",
                    onSelect:function (date) {
                        ngModelCntrl.$setViewValue(date);
                        scope.$apply();
                    }
                });
                element.next().click(function(){
            		element.datepicker("show");
            	});
            });
        }
    };
});
